package com.shop.dao;

import com.shop.dto.MemberLoginDto;
import com.shop.entity.MemberEntity;
import com.shop.entity.OrderItemEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 
 *
 * @author wzby
 * @date 2022-12-02 13:24:15
 */
@Mapper
public interface OrderItemDao {

    @Insert("insert into order_item (productId,productName,productImg,price,qty,orderId)" +
            " values (#{productId},#{productName},#{productImg},#{price},#{qty},#{orderId})")
    int insert(OrderItemEntity orderItem);

    @Insert("<script> " +
            "insert into "  +
            " order_item (productId,productName,productImg,price,qty,orderId) " +
            "values " +
            "<foreach collection='items'  item='item' separator=','> "+
            "(#{item.productId},#{item.productName},#{item.productImg},#{item.price},#{item.qty},#{item.orderId})"+
            "</foreach> </script>" )
    int insertAll(List<OrderItemEntity> items);
}
